#include <stdio.h>
#include <math.h>

//using namespace std;

int main()
{
    int n;
    char ss1[5], ss2[5];
    int cc1, cc2;

	scanf("%d", &n);
    while (n--)
    {
        scanf("%s%s", ss1, ss2);
        cc1 = abs(ss1[0] - ss2[0]);
        cc2 = abs(ss1[1] - ss2[1]);
        
		printf("%d ", cc1>cc2?cc1:cc2);
		
		if (cc1==0 && cc2==0) printf("0 ");
        else if (ss1[0] == ss2[0] || ss1[1] == ss2[1] || cc1==cc2) printf("1 ");
        else printf("2 ");
        
		if (cc1==0 && cc2==0) printf("0 ");
        else if (ss1[0] == ss2[0] || ss1[1] == ss2[1] ) printf("1 ");
        else printf("2 ");
        
		if (cc1==0 && cc2==0) printf("0 ");
		else if (cc1 == cc2) printf("1");
        else if ( (cc1+cc2)%2==0) printf("2");
        else printf("Inf");
        printf("\n");
    }    
    
    
}    
